<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>ajax-get请求</title>
		<script src="jquery.js">
			
		</script>
	</head>
	<body>
		<form action="index.html" method="get" enctype="application/x-www-form-urlencoded">
			<input type="text" name="username" placeholder="请输入用户名" />
			<br><br>
			<input type="password" name="password" placeholder="请输入密码" />
			<br><br>
			<button type="submit">登录</button>
		</form>
	</body>
	<script>
		//AJAX:Asynchronous javascript and xml
		//异步 的js与xml
		//在不重载页面的条件下更新页面数据
		$('form').submit(function(ev){
			//阻止默认事件的发生
			ev.preventDefault();
			console.log('已经阻止');
			//获取表单数据，自动将其转换成字符串序列化对
			//name=value&name=value;
			var data = $(this).serialize();
			$.get({
				url:'index.html',
				data:data,
				success:function(resData){
					//内部参数：服务端返回的响应数据
				}
			})
		})
	</script>
</html>
